home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr48
/
pas_0593.zip
/
BIGDRIVE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-05-30
|
1KB
|
42 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 244 of 292
From : Bo Bendtsen 2:231/111.0 15 May 93 11:13
To : All
Subj : Drive size, free if more than 1 gigabyte
────────────────────────────────────────────────────────────────────────────────
Hello All!
Many people does not think about it, but DOS is limited to report more than
1 gigabyte. Myself I have a 1.3 giga and a 1.0 giga, and made these routines for
my programs for knowing if the size is more than 1 giga. Using the normal
DiskSize and DiskFree could get you strange result, sometimes it could report
maybe 100MB when it is really 1 giga.
If the size og free space is 1 you can assume that the drive is more than 1
gigabyte.}
Function DriveSize(d:byte):Longint; { -1 not found, 1=>1 Giga }
Var
R : Registers;
Begin
With R Do
Begin
ah:=$36; dl:=d; Intr($21,R);
If AX=$FFFF Then DriveSize:=-1 { Drive not found }
Else If (DX=$FFFF) or (Longint(ax)*cx*dx=1073725440) Then DriveSize:=1
Else DriveSize:=Longint(ax)*cx*dx;
End;
End;
Function DriveFree(d:byte):Longint; { -1 not found, 1=>1 Giga }
Var
R : Registers;
Begin
With R Do
Begin
ah:=$36; dl:=d; Intr($21,R);
If AX=$FFFF Then DriveFree:=-1 { Drive not found }
Else If (BX=$FFFF) or (Longint(ax)*bx*cx=1073725440) Then DriveFree:=1
Else DriveFree:=Longint(ax)*bx*cx;
End;
End;